package com.stgy.lease.web.api.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.stgy.lease.common.exception.StgyException;
import com.stgy.lease.common.result.ResultCodeEnum;
import com.stgy.lease.model.domain.CityInfo;
import com.stgy.lease.web.api.mapper.CityInfoMapper;
import com.stgy.lease.web.api.service.CityInfoService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author lingx
* @description 针对表【city_info】的数据库操作Service实现
* @createDate 2024-08-28 11:00:29
*/
@Service
public class CityInfoServiceImpl extends ServiceImpl<CityInfoMapper, CityInfo>
    implements CityInfoService {

    //根据省份id查询城市信息列表
    @Override
    public List<CityInfo> listByProvinceId(Long id) {
        if (id == null || id < 0) {
            throw new StgyException(ResultCodeEnum.DATA_EXISTS_ERROR);
        }
        LambdaQueryWrapper<CityInfo> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CityInfo::getProvinceId,id);
        return this.list(wrapper);
    }
}




